<?php
!defined('P_W') && exit('Forbidden');

class PW_HouseFeedDB extends BaseDB {

	var $_tableName = "pw_house_feed";
	
	function getCountByHid($hid) {
		return $this->_db->get_value('SELECT COUNT(*) AS sum FROM ' . $this->_tableName . ' WHERE hid=' . pwEscape($hid));
	}

	function getByHid($hid, $offset = 0, $limit = 0) {
		$_sql_limit = $limit ? pwLimit($offset, $limit) : '';
		$query = $this->_db->query('SELECT * FROM ' . $this->_tableName . ' WHERE hid=' . pwEscape($hid) . ' ORDER BY postdate DESC ' . $_sql_limit);
		return $this->_getAllResultFromQuery($query);
	}
}
?>